package com.jackiechan.day15;

import java.util.HashSet;
import java.util.Set;

public class T_Thread {
    public static void main(String[] args) throws InterruptedException {
        show();
    }

    private static void show() throws InterruptedException {
        MyThread mythread = new MyThread();
        Thread thread = new Thread(mythread);
        Thread thread1 = new Thread(mythread);
        Thread thread2 = new Thread(mythread);
        thread.start();
        thread1.start();
        thread2.start();
        Thread.sleep(20000);
        System.out.println(mythread.set.size());
    }
}

class MyThread extends Thread {
    int i = 1;
    Set set = new HashSet();
    @Override
    public void run() {
        for (int j=0;j<10000;j++){
            set.add(i++);
        }
//        System.out.println(this.getName());
//        for (int row = 1; row <= 10; row++) {
//            System.out.print(" "+this.getName().toCharArray()[0]);
//            System.out.print(row);
//        }
//        System.out.println(" end");
    }




}